<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
<script>

  const routes = [
  {
    path: '/guide',
    redirect: '/guide/index',
    meta: { title: '引导页', icon: 'guide', affix: true },
    children: [
      {
        path: 'index',
        component: () => import('@/views/guide/index/index'),
        name: 'Guide-index',
        meta: { title: '系统引导页' }
      },
      {
        path: 'system',
        component: () => import('@/views/guide/system/index'),
        name: 'Guide-sys',
        meta: { title: '操作引导页' }
      }
    ]
  },
  {
    path: '/guide2',
    redirect: '/guide2/index',
    meta: { title: '引导页', icon: 'guide', affix: true },
    children: [
      {
        path: 'index',
        component: () => import('@/views/guide/index/index'),
        name: 'Guide-index-2',
        meta: { title: '系统引导页1' }
      },
      {
        path: 'system-2',
        component: () => import('@/views/guide/system/index'),
        name: 'Guide-sys',
        meta: { title: '操作引导页2' }
      },
      {
        path: 'system-3',
        component: () => import('@/views/guide/system/index'),
        name: 'Guide-sys',
        meta: { title: '操作引导页2' }
      }
    ]
  },
  {
    path: '/guide3',
    redirect: '/guide3/index',
    meta: { title: '引导页', icon: 'guide', affix: true },
    children: [
      {
        path: 'index',
        component: () => import('@/views/guide/index/index'),
        name: 'Guide-index-2',
        meta: { title: '系统引导页1' }
      },
      {
        path: 'system-2',
        component: () => import('@/views/guide/system/index'),
        name: 'Guide-sys',
        meta: { title: '操作引导页2' }
      }
    ]
  }
]

const menuList = [
  {
    path: '/guide',
    menuId: '201908221505',
    children: [
      { path: 'system', menuId: '2019082215080' },
      { path: 'index', menuId: '2019082215050' }
    ]
  },
  {
    path: '/guide2',
    menuId: '201908221505',
    children: [
    {
        path: 'system-2',
        component: () => import('@/views/guide/system/index'),
        name: 'Guide-sys',
        meta: { title: '操作引导页2' }
      }
    ]
  },
  {
    path: '/guide3',
    menuId: '201908221505'
  }
]

function filterAsyncRoutes(routes, menuList) {
   let res = []
   routes.forEach(item => {
      menuList.forEach(menu => {
        if(item.path === menu.path) {
           let tmp = { ... item }
           tmp.children = []
           if(menu.children && menu.children.length > 0) {
              tmp.children =  hasPermission(item.children, menu.children)
           }
           res.push(tmp)
        }
      })
   })
   return res
}

</script>
</body>
</html>
